<?php
function view_advertisement_list($advertisement_list)
{
	$list = "<table class='advertisement_list'>\n";

	foreach ($advertisement_list as $advertisement)
	{
		$list = $list . view_advertisement($advertisement["name"],  $advertisement["detail_view_url"]);
	}
	$list = $list . "</table>\n";

	return $list;
}

function view_advertisement($name, $detail_view_url)
{
	$advertisement = sprintf(
	"<table class='advertisement_intro'>
		<tr> <td class='advertisement_name'><a href='%s'>%s</a> </td></tr>
	</table>",
		$detail_view_url, $name
	);

	return $advertisement;
}

function view_advertisement_detail($name, $details, $publish_time, $click_count)
{
	$advertisement_detail = sprintf(
		"<!--advertisement start-->
		<div class='advertisement'>
		 <div class='advertisement_details'>详细介绍:%s</div>
		</div>
		<!--advertisement end-->",
		$details
	);
	return $advertisement_detail;	
}

?>
